***************************************
* PROGRAM TO CONVERT DATE TO TAX YEAR *
***************************************
capture program drop convert_date_to_taxyear
program define convert_date_to_taxyear
	
	syntax namelist(min=2 max=2)
	
	tempvar audityear_open_yr  audityear_open_mth audityear_open_day audityear_open_temp
	gen `audityear_open_yr'  = year(`1')
	gen `audityear_open_mth' = month(`1')
	gen `audityear_open_day' = day(`1')
	gen `audityear_open_temp'  = `audityear_open_yr' + (`audityear_open_mth'>4) + (`audityear_open_mth'==4&`audityear_open_day'>5.5) 
	gegen `2' = max(`audityear_open_temp') , by(utr_no)

end
